]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
viewSelector: Rework Ctrl+Alt+Tab support
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Wed, 27 Jan 2021 15:55:20 +0000 (12:55 -0300)
committerMarge Bot <marge-bot@gnome.org>
Fri, 29 Jan 2021 15:01:03 +0000 (15:01 +0000)
Now that there's only a ACTIVITIES and a SEARCH page, the old method of handling
keyboard tabbing (extra parameters to ViewSelector._addPage()) limits what we can
do.

Manually set up the Ctrl+Alt+Tab support for each element.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1593>

js/ui/viewSelector.js

index b0d8f8b9c2aa3f3a173ed5946f44478caf881887..33b761f140fb941c184a081b7116cc83f851589e 100644 (file)
@@ -7,7 +7,6 @@ const Signals = imports.signals;
 const AppDisplay = imports.ui.appDisplay;
 const Main = imports.ui.main;
 const OverviewControls = imports.ui.overviewControls;
-const Params = imports.misc.params;
 const Search = imports.ui.search;
 const ShellEntry = imports.ui.shellEntry;
 const WorkspacesView = imports.ui.workspacesView;
@@ -257,10 +256,35 @@ var ViewSelector = GObject.registerClass({
         this._activitiesPage =
             this._addPage(activitiesContainer, _('Activities'), 'view-app-grid-symbolic');
 
+        Main.ctrlAltTabManager.addGroup(
+            this.appDisplay,
+            _('Applications'),
+            'edit-find-symbolic', {
+                proxy: this,
+                focusCallback: () => {
+                    this._showPage(this._activitiesPage);
+                    this._showAppsButton.checked = true;
+                    this.appDisplay.navigate_focus(
+                        null, St.DirectionType.TAB_FORWARD, false);
+                },
+            });
+
+        Main.ctrlAltTabManager.addGroup(
+            this._workspacesDisplay,
+            _('Windows'),
+            'focus-windows-symbolic', {
+                proxy: this,
+                focusCallback: () => {
+                    this._showPage(this._activitiesPage);
+                    this._showAppsButton.checked = false;
+                    this._workspacesDisplay.navigate_focus(
+                        null, St.DirectionType.TAB_FORWARD, false);
+                },
+            });
+
         this._searchResults = new Search.SearchResultsView();
-        this._searchPage = this._addPage(this._searchResults,
-                                         _("Search"), 'edit-find-symbolic',
-                                         { a11yFocus: this._entry });
+        this._searchPage = this._addPage(this._searchResults);
+        Main.ctrlAltTabManager.addGroup(this._entry, _('Search'), 'edit-find-symbolic');
 
         // Since the entry isn't inside the results container we install this
         // dummy widget as the last results container child so that we can
@@ -364,19 +388,8 @@ var ViewSelector = GObject.registerClass({
         super.vfunc_hide();
     }
 
-    _addPage(actor, name, a11yIcon, params) {
-        params = Params.parse(params, { a11yFocus: null });
-
+    _addPage(actor) {
         let page = new St.Bin({ child: actor });
-
-        if (params.a11yFocus) {
-            Main.ctrlAltTabManager.addGroup(params.a11yFocus, name, a11yIcon);
-        } else {
-            Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon, {
-                proxy: this,
-                focusCallback: () => this._a11yFocusPage(page),
-            });
-        }
         page.hide();
         this.add_actor(page);
         return page;
@@ -433,11 +446,6 @@ var ViewSelector = GObject.registerClass({
             this._animateIn();
     }
 
-    _a11yFocusPage(page) {
-        this._showAppsButton.checked = page == this._activitiesPage;
-        page.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
-    }
-
     _onShowAppsButtonToggled() {
         this._showPage(this._activitiesPage);
     }